package com.wooribank.android.tablet;

import java.io.InputStream;
import java.math.BigInteger;
import java.util.ArrayList;

import android.graphics.Color;
import android.os.Parcel;
import android.os.Parcelable;

public class Account implements Parcelable {
	private String name;
	private String number;
	private String nickname;
	private BigInteger money;
	private int color;

	public Account() {

	}

	public Account(String name, String number, String nickname, BigInteger money, int color) {
		super();
		this.name = name;
		this.number = number;
		this.nickname = nickname;
		this.money = money;
		this.color = color;
	}

	public Account(Parcel in) {
		Account account = new Account();
		account.setName(in.readString());
		account.setNumber(in.readString());
		account.setNickname(in.readString());
		account.setMoney(new BigInteger(in.readString()));
		account.setColor(in.readInt());
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public BigInteger getMoney() {
		return money;
	}

	public void setMoney(BigInteger money) {
		this.money = money;
	}

	public int getColor() {
		return color;
	}

	public void setColor(int color) {
		this.color = color;
	}

	public static ArrayList<Account> parseAccounts(InputStream inputStream) {
		Account a1 = new Account("정기적금", "32423-14234-1324", "계좌별명", new BigInteger("323153212432"),
				0xFFC030FF);
		Account a2 = new Account("정기예금", "33213-43122-1231", "계좌별명", new BigInteger("32312432"), 0xFFC03055);
		Account a3 = new Account("AMA모계좌", "43213-11111-1324", "계좌별명", new BigInteger("3231532124322323"),
				Color.BLUE);
		ArrayList<Account> list = new ArrayList<Account>();
		list.add(a1);
		list.add(a2);
		list.add(a3);
		return list;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int arg1) {
		dest.writeString(name);
		dest.writeString(number);
		dest.writeString(nickname);
		dest.writeString(money.toString());
		dest.writeInt(color);
	}

	public static final Parcelable.Creator<Account> CREATOR = new Parcelable.Creator<Account>() {
		public Account createFromParcel(Parcel in) {
			return new Account(in);
		}

		public Account[] newArray(int size) {
			return new Account[size];
		}
	};
}
